<template>
  <view class="" style="height: 100%">
    <scroll-view
      class="scroll-view"
      style="height: 100%"
      scroll-y
      :refresher-threshold="45"
      refresher-background="lightgreen"
      :refresher-enabled="true"
      :refresher-triggered="triggered"
      @refresherrefresh="onRefresh"
      @refresherrestore="onRestore"
    >
    </scroll-view>
  </view>
</template>
<script>
export default {
  data() {
    return {
      triggered: false,
    };
  },
  onLoad() {},
  methods: {
    onRefresh() {
      // 这一步必须，不然后面关不了
      this.triggered = true;
      console.log("开始");
      setTimeout(() => {
        this.triggered = false; //触发onRestore，并关闭刷新图标
      }, 1000);
    },
    onRestore() {
      console.log("复位");
    },
  },
};
</script>
<style>
page {
  height: 100%;
  background-color: #fff;
}

.scroll-view {
  box-sizing: border-box;
  border: 1px solid red;
}
</style>
